<?php if (!defined('THINK_PATH')) exit();?><script type="text/javascript">
//选择事件
function S_NodeCheck(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId),
        nodes = zTree.getCheckedNodes(true)
    var ids = '', names = ''
    
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id
        names += ','+ nodes[i].name
    }
    if (ids.length > 0) {
        ids = ids.substr(1), names = names.substr(1)
    }
    
    var $from = $('#'+ treeId).data('fromObj')
    $("#pid").val(ids);
    
    if ($from && $from.length) $from.val(names)
}
//单击事件
function S_NodeClick(event, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId)
    
    zTree.checkNode(treeNode, !treeNode.checked, true, true)
    
    event.preventDefault()
}
</script>
<div class="bjui-pageContent">
    <div style="margin:15px;">
        <fieldset>
            <legend>添加栏目</legend>
            <form action="<?php echo U(add);?>" class="pageForm" data-toggle="validate">
            <input type="hidden" name="closeCurrent" value="true"  />
            <input type="hidden" name="tabid" value="<?php echo (CONTROLLER_NAME); ?>"  />
            <input type="hidden" name="dialogid" value="<?php echo ($dialogid); ?>"/>
            <table class="table table-hover">
                <thead>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            上级分类
                        </td>
                        <td>
                            <input type="hidden" name="pid" id="pid" value="" />
                            <input type="text" name="menus" id="ztree_menus" data-toggle="selectztree"  data-tree="#select_tree" class="form-control" readonly>
                            <ul id="select_tree" class="ztree hide" data-toggle="ztree" data-expand-all="true" data-check-enable="true" data-chk-style="radio" data-radio-type="all" data-on-check="S_NodeCheck" data-on-click="S_NodeClick">
                            <?php if(is_array($category)): $i = 0; $__LIST__ = $category;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li data-id="<?php echo ($vo["id"]); ?>" data-pid="<?php echo ($vo["pid"]); ?>"><?php echo ($vo["name"]); ?></li><?php endforeach; endif; else: echo "" ;endif; ?>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            栏目名称
                        </td>
                        <td><input type="text" name="name"/></td>
                    </tr>
                    <tr>
                        <td>
                           英文名称
                        </td>
                        <td>
                            <input type="text" name="ename" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                           栏目排序
                        </td>
                        <td>
                            <input type="text" name="sort" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                           模板
                        </td>
                        <td>
                            <input type="text" name="templets" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                           描述
                        </td>
                        <td>
                            <textarea cols="30" name="description" rows="3" data-toggle="autoheight" class="form-control autosize" style="overflow: hidden; word-wrap: break-word; resize: horizontal; height: 56px; width: 300px;"></textarea>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
        </fieldset>
    </div>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" >关闭</button></li>
        <li><button type="submit" class="btn btn-default">提交</button></li>
    </ul>
</div>